From: Xiaoguang Wang Date: Fri, 18 Nov 2016 08:00:01 +0000 (+0800) Subject: appDisplay: Fix completion handler for empty animations X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~626 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=09e6bb5d5660956049d63ba67b4320374a0b20f4;p=gnome-shell.git appDisplay: Fix completion handler for empty animations If an onComplete handler is passed to animate(), it is set to run at the end of the animation via the icon grid's ::animation-done signal. Currently the signal is connected after starting the animation, with the result that the handler doesn't run when the animation completes immediately (because there are no icons to animate). Fix this by only starting the animation after connecting the signal. https://bugzilla.gnome.org/show_bug.cgi?id=774381 --- diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index a75d75075..5b48d5e6e 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -210,6 +210,14 @@ const BaseAppView = new Lang.Class({ }, animate: function(animationDirection, onComplete) { + if (onComplete) { + let animationDoneId = this._grid.connect('animation-done', Lang.bind(this, + function () { + this._grid.disconnect(animationDoneId); + onComplete(); + })); + } + if (animationDirection == IconGrid.AnimationDirection.IN) { let toAnimate = this._grid.actor.connect('notify::allocation', Lang.bind(this, function() { @@ -225,14 +233,6 @@ const BaseAppView = new Lang.Class({ } else { this._doSpringAnimation(animationDirection); } - - if (onComplete) { - let animationDoneId = this._grid.connect('animation-done', Lang.bind(this, - function () { - this._grid.disconnect(animationDoneId); - onComplete(); - })); - } }, animateSwitch: function(animationDirection) {